import request from '@/utils/request'

// 创建生产订单
export function createOrder(data) {
  return request({
    url: '/production/order/create',
    method: 'post',
    data: data
  })
}

// 更新生产订单
export function updateOrder(data) {
  return request({
    url: '/production/order/update',
    method: 'put',
    data: data
  })
}

// 删除生产订单
export function deleteOrder(id) {
  return request({
    url: '/production/order/delete?id=' + id,
    method: 'delete'
  })
}

/** 批量删除生产订单 */
export function deleteOrderList(ids) {
  return request({
    url: `/production/order/delete-list?ids=${ids.join(',')}`,
    method: 'delete'
  })
}

// 获得生产订单
export function getOrder(id) {
  return request({
    url: '/production/order/get?id=' + id,
    method: 'get'
  })
}

// 获得生产订单分页
export function getOrderPage(params) {
  return request({
    url: '/production/order/page',
    method: 'get',
    params
  })
}
// 导出生产订单 Excel
export function exportOrderExcel(params) {
  return request({
    url: '/production/order/export-excel',
    method: 'get',
    params,
    responseType: 'blob'
  })
}